package com.appkubes.mall.restful.application.goods.sku.service.impl;

import com.appkubes.mall.core.entity.MallGoodsSpecific;
import com.appkubes.mall.core.service.impl.BaseMallGoodsSpecificServiceImpl;
import com.appkubes.mall.restful.application.goods.sku.dao.GoodsSpecificDao;
import com.appkubes.mall.restful.application.goods.sku.service.GoodsSpecificService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsSpecificServiceImpl extends BaseMallGoodsSpecificServiceImpl implements GoodsSpecificService {

    @Autowired
    GoodsSpecificDao goodsSpecificDao;


    public MallGoodsSpecific findByGoodsKey(String goodsKey) {
        MallGoodsSpecific query = new MallGoodsSpecific();
        query.setGoodsKey(goodsKey);

        List<MallGoodsSpecific> goodsSpecificList = this.selectListByEntity(query);
        if (goodsSpecificList.size() == 0) return null;
        return goodsSpecificList.get(0);
    }

    public List<MallGoodsSpecific> getList(String goodsKey) {
        MallGoodsSpecific query = new MallGoodsSpecific();
        query.setGoodsKey(goodsKey);
        return this.selectListByEntity(query);
    }
}
